<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8" />
        <title>用户管理 - 默笙后台管理系统</title>
        <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
        <meta content="这不仅仅是一个后台管理系统，它基于BT4，超强的自适应，简洁，高效，大方" />
        <meta content="Mosheng" name="author" />


        <!-- App favicon -->
        <link rel="shortcut icon" href="{$Think.const.ADMIN_URL}assets/images/favicon.ico">

        <!-- third party css -->
        <link href="{$Think.const.ADMIN_URL}css/vendor/dataTables.bootstrap4.css" rel="stylesheet" type="text/css" />
        <link href="{$Think.const.ADMIN_URL}css/vendor/responsive.bootstrap4.css" rel="stylesheet" type="text/css" />
        <link href="{$Think.const.ADMIN_URL}css/vendor/buttons.bootstrap4.css" rel="stylesheet" type="text/css" />
        <link href="{$Think.const.ADMIN_URL}css/vendor/select.bootstrap4.css" rel="stylesheet" type="text/css" />
        <!-- third party css end -->

        <!-- App css -->
        <link href="{$Think.const.ADMIN_URL}/css/vendor/sweetalert2.min.css" rel="stylesheet" type="text/css" />
        <link href="{$Think.const.ADMIN_URL}css/bootstrap.min.css" rel="stylesheet" type="text/css" />
        <link href="{$Think.const.ADMIN_URL}css/icons.min.css" rel="stylesheet" type="text/css" />
        <link href="{$Think.const.ADMIN_URL}css/app.min.css" rel="stylesheet" type="text/css" />

    </head>

    <body>

        <!-- 公共头部开始-->
        <include file="Common:header" />
        <!-- 公共头部结束-->

        <div class="wrapper">
            <div class="container-fluid">

                <!-- start page title -->
                <div class="row">
                    <div class="col-12">
                        <div class="page-title-box">
                            <div class="page-title-right">
                                <ol class="breadcrumb m-0">
                                    <li class="breadcrumb-item"><a href="#">默笙</a></li>
                                    <li class="breadcrumb-item"><a href="#">用户</a></li>
                                    <li class="breadcrumb-item active">登录日志</li>
                                </ol>
                            </div>
                            <h4 class="page-title">登录日志</h4>
                        </div>
                    </div>
                </div>     
                <!-- end page title --> 
                <div class="row">
                <div class="col-12">
                    <div class="card">
                        <div class="card-body">
                            <h4 class="header-title">登录日志</h4>
                                <p class="text-muted font-13 mb-4">
                                    在此观看所有<code>用户</code>登录日志
                                    <eq name="at.is_all" value="0">
                                            您可以：  
                                            <a  onClick="ty_del(this,'{$vo.id}')" title="删除"><i class="mdi mdi-delete mr-1 text-muted"></i>清除所有日志</a>
                                    </eq>
                            </p>

                            <table id="key-datatable" class="table dt-responsive nowrap">
                                <thead>
                                    <tr>
                                        <th>ID</th>
                                        <th>用户ID</th>
                                        <th>用户昵称</th>
                                        <th>登录IP</th>
                                        <th>登录时间</th>
                                        

                                    </tr>
                                </thead>


                                <tbody>
                                    <volist name="list" id="vo">
                                        <tr>
                                            <td>{$vo.id}</td>
                                            
                                            <td> <span value="{$vo.uid}" class="copyVideo"  onclick="copyVideoUrl(event)">{$vo.uid}</span></td>
                                            <td>
                                                {$vo.name}
                                            </td>
                                           
                                            <td>
                                                {$vo.ip}
                                            </td>
                                            <td>
                                                {$vo.date|date='Y/m/d H:i',###}
                                            </td>
                                        </tr>
                                        </volist>
                                </tbody>
                            </table>

                        </div>
                        <!-- end card body-->
                    </div>
                    <!-- end card -->
                </div>
                <!-- end col-->
            </div>

                
                
            </div> <!-- end container -->
        </div>
        <!-- end wrapper -->


        <!-- 公共底部开始-->
        <include file="Common:footer" />
        <!-- 公共底部结束-->


        <!-- App js -->
        <script src="{$Think.const.ADMIN_URL}/js/vendor.min.js"></script>
        <script src="{$Think.const.ADMIN_URL}/js/app.min.js"></script>

        <!-- third party js -->
        <script src="{$Think.const.ADMIN_URL}js/vendor/jquery.dataTables.js"></script>
        <script src="{$Think.const.ADMIN_URL}/js/vendor/dataTables.bootstrap4.js"></script>
        <script src="{$Think.const.ADMIN_URL}/js/vendor/dataTables.responsive.min.js"></script>
        <script src="{$Think.const.ADMIN_URL}/js/vendor/responsive.bootstrap4.min.js"></script>
        <script src="{$Think.const.ADMIN_URL}/js/vendor/dataTables.buttons.min.js"></script>
        <script src="{$Think.const.ADMIN_URL}/js/vendor/buttons.bootstrap4.min.js"></script>
        <script src="{$Think.const.ADMIN_URL}/js/vendor/buttons.html5.min.js"></script>
        <script src="{$Think.const.ADMIN_URL}/js/vendor/buttons.flash.min.js"></script>
        <script src="{$Think.const.ADMIN_URL}/js/vendor/buttons.print.min.js"></script>
        <script src="{$Think.const.ADMIN_URL}/js/vendor/dataTables.keyTable.min.js"></script>
        <script src="{$Think.const.ADMIN_URL}/js/vendor/dataTables.select.min.js"></script>
        <!-- third party js ends -->
        <script src="{$Think.const.ADMIN_URL}/layer/layer.js"></script>
        <script src="{$Think.const.ADMIN_URL}/js/vendor/sweetalert2.min.js"></script>
        <script src="{$Think.const.ADMIN_URL}/js/pages/sweet-alerts.init.js"></script>
        <!-- demo app -->
        <script src="{$Think.const.ADMIN_URL}/js/pages/datatables.init.js"></script>
        <!-- end demo js-->
        <script type="text/javascript">
            function copyVideoUrl(event){
 
             var value = $(event.target).closest("span").attr('value');
             var success;
             var $temp = $("<input>");
             $("body").append($temp);
             $temp.val(value).select();
             try{
                success = document.execCommand("copy");
             }catch (e){
                 succeed = false;
             }
             if(success){
                 swal({
                         title: "复制成功！",
                             text: "<?php echo($message); ?>",
                             type: "success",
                             confirmButtonClass: "btn btn-confirm mt-2"
                     })
             }
 
             $temp.remove();
         }
         
         function ty_del(obj, id) {
            var id = id;
            layer.confirm('确认要清除日志吗？', function (index) {

                $.ajax({
                    type: 'POST',
                    url: '{:U('admin.php/user/clearloginep')}',
                    dataType: 'json',
                    data: { id: id },
                    success: function (data) {
                        console.log(data);
                        if (data.status == '1') {
                            layer.msg(data.info);//layer.msg('不开心。。', {icon: 5});
                            window.location.reload();
                        } else {
                            layer.msg(data.info);
                        }
                    },
                    error: function (data) {
                        layer.msg('删除失败!');
                    },
                });
            });
        }
         </script>
    </body>
</html>
